import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import federation from "@originjs/vite-plugin-federation"
import topLevelAwait from 'vite-plugin-top-level-await'
export default defineConfig({
  plugins: [
    topLevelAwait({
      // The export name of top-level await promise for each chunk module
      promiseExportName: '__tla',
      // The function to generate import names of top-level await promise in each chunk module
      promiseImportName: i => `__tla_${i}`
    }),
    federation({
      name: 'remote-app',
      filename: 'remoteEntry.js',
      // 需要暴露的模块
      exposes: {
        './table': './src/components/Table.vue',
        './description': './src/components/Description.vue',
        './form': './src/components/Form.vue',
        './utils': './src/utils/index.js'

      },
      shared: ['vue', 'ant-design-vue']
    }),
    vue()],
})
